import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/layout/Layout'

Vue.use(Router)

export const constantRouterMap = [
  {path: '/login',component: () => import('@/views/login/LoginUser'),hidden: true,},
  {
    path: '/',
    component: Layout,
    redirect: 'dashboard',
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index'),
      name: 'dashboard',
      meta: { title: '店铺概况', icon: 'iconfont icon-tubiao1', noCache: true }
    }]
  },
  { path: '/404', redirect: '/',  hidden: true },
  {
    path: '/book',
    component: Layout,
    redirect: '/book/bookList',
    meta:{ title:'书库管理',icon: 'iconfont icon-yg-shujia'},
    children: [{
      path: 'bookList',
      name: 'BookList',
      component: () => import('@/views/book/BookList'),
      meta: { title: '书库管理', icon: 'iconfont icon-yg-shujia', noCache: true },
    },{
      hidden: true,
      path: 'draftList',
      name: 'DraftList',
      component: () => import('@/views/book/DraftList'),
      meta: { title: '草稿箱', icon: 'book', noCache: true },
    },{
      hidden: true,
      path: 'bookDetail',
      name: 'BookDetail',
      component: () => import('@/views/book/BookDetail'),
      meta: { title: '书籍详情', noCache: true },
    }]
  },
  {
    path: '/publish',
    component: Layout,
    redirect: '/publish/template',
    children: [{
      path: 'template',
      name: 'TemplateSelect',
      component: () => import('@/views/publish/TemplateSelect'),
      meta: { title: '店铺管理', icon: 'iconfont icon-dianpu', noCache: true },
    },{
      hidden: true,
      path: 'templateBuild',
      name: 'TemplateBuild',
      component: () => import('@/views/publish/TemplateBuild'),
      meta: { title: '店铺搭建', noCache: true },
    },{
      hidden: true,
      path: 'publishingDetail',
      name: 'PublishingDetail',
      component: () => import('@/views/publish/PublishingDetail'),
      meta: { title: '店铺设置', noCache: true },
    }]
  },
  {
    path: '/distribution',
    component: Layout,
    redirect: '/distribution/distributionList',
    children: [{
      path: 'distributionList',
      name: 'DistributionList',
      component: () => import('@/views/distribution/DistributionList'),
      meta: { title: '分销管理', icon: 'iconfont icon-fenxiang'},
    }]
  },
  {
    path: '/data',
    component: Layout,
    redirect: '/data/dataIndex',
    children: [{
      path: 'dataIndex',
      name: 'DataIndex',
      component: () => import('@/views/data/DataIndex'),
      meta: { title: '数据管理', icon: 'iconfont icon-shuju', noCache: true },
    }]
  },
  // {
  //   path: '/webUser',
  //   component: Layout,
  //   redirect: '/webUser/webUserList',
  //   children: [{
  //     path: 'webUserList',
  //     name: 'WebUser',
  //     component: () => import('@/views/webUser/WebUserList'),
  //     meta: { title: '用户列表', icon: 'iconfont icon-yonghu' }
  //   },{
  //     hidden:true,
  //     path:'webUserDetail',
  //     name:'WebUserDetail',
  //     component: () => import('@/views/webUser/WebUserDetail'),
  //     meta: { title: '用户详情', icon: 'webUserDetail' },
  //   }]
  // },
  // {
  //   path: '/role',
  //   component: Layout,
  //   redirect: '/role/roleList',
  //   children: [{
  //     path: 'roleList',
  //     name: 'Role',
  //     component: () => import('@/views/role/RoleList'),
  //     meta: { title: '角色列表', icon: 'iconfont icon-yuechi'},
  //   },{
  //     hidden: true,
  //     path: 'roleDetail',
  //     name: 'RoleDetail',
  //     component: () => import('@/views/role/RoleDetail'),
  //     meta: { title: '角色详情', icon: 'roleDetail' },
  //   }]
  // },

]

export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export const asyncRouterMap = [

]

export const componentsMap = {
  // "Layout":Layout,
  // "RoleList":() => import('@/views/role/RoleList'),
  // "RoleDetail":() => import('@/views/role/RoleDetail'),
  // "WebUserList":() => import('@/views/webUser/WebUserList'),
  // "WebUserDetail":() => import('@/views/webUser/WebUserDetail'),
  // "ProductType":() => import('@/views/productType/ProductTypeList'),
  // "PinProduct":() => import('@/views/pinProduct/PinProductList'),
  // "Product":() => import('@/views/product/ProductList'),
  // "Order":() => import('@/views/order/OrderList'),
  // "Promote":() => import('@/views/promote/PromoteList'),
  // "DistributionSettingDetail":() => import('@/views/distribution/DistributionSettingDetail'),
  // "AgencyManagement":() => import('@/views/agency/AgencyManagement'),
  // "SubordinateList":() => import('@/views/agency/SubordinateList'),
  // "DistributionBillList":() => import('@/views/distribution/DistributionBillList'),
  // "WithdrawCash":() => import('@/views/withdrawCash/WithdrawCashAuditList'),
}
